import BaseEntity from "@/framework/domain/BaseEntity";
import ChargeTypeEnum from "@/feature/pdt/infra/constants/ChargeTypeEnum";
import FreightFeeArea from "@/feature/pdt/domain/FreightFeeArea";

export default class FreightTemplate extends BaseEntity {
  constructor(props) {
    super(props)
    this.chargeType = ChargeTypeEnum.getById(this.chargeType)
    if (this.feeArea && this.feeArea.length) {
      this.feeArea = this.feeArea.map(el => new FreightFeeArea(el))
    }
  }

  get canDelete() {
    return !this.isSystem
  }

  get canEdit() {
    return !this.isSystem
  }

  get canOp() {
    return this.canEdit && this.canDelete
  }
}
